#coding:utf-8
'''
画板：直线连接
'''
from tkinter import *
status=0
def draw(event):
	global x,y,status
	# canvas.create_text(event.x,event.y,text='.')
	if status==0:
		status=1
		x,y=event.x,event.y
	else:
		canvas.create_line(x,y,event.x,event.y,width=3,fill='red')
		x,y=event.x,event.y
def cls(event):
	global status
	status=0
root=Tk()
canvas=Canvas(root,width=600,height=400,bg='gray')
canvas.bind('<Button-1>',draw)
canvas.bind('<Button-3>',cls)
canvas.pack()
root.mainloop()
